Skip to content

Stop drop! from running VACUUM, which renumbered rowids and failed in transactions - #378

Merged
quinnj-bot[bot] merged 2 commits into
masterfrom
claude/drop-without-vacuum
Nov 16, 2026
Merged

quinnj-bot[bot] merged 2 commits into
masterfrom
claude/drop-without-vacuum

Conversation

@quinnj-bot

@quinnj-bot quinnj-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Why

SQLite.drop! ran VACUUM after every drop. That had two effects users don't expect from dropping one table:

  • It renumbered the rowids of every other table without an INTEGER PRIMARY KEY. A table with rowids 3, 4 (after deleting rows 1 and 2) came back as 1, 2, so any rowid an application had stored now pointed at a different row.
  • SQLite refuses VACUUM inside a transaction. drop! inside DBInterface.transaction always threw cannot VACUUM from within a transaction, and the transaction rolled back the drop.

What changed

  • drop! only drops the table. Its docstring says to run VACUUM yourself to reclaim the space, and warns about the rowid effect.

Scope

  • The database file no longer shrinks after drop!. Users who relied on that can run DBInterface.execute(db, "VACUUM").
  • dropindex!, createindex!, and removeduplicates! don't vacuum and are unchanged.

Blast Radius

Every drop! call. It is faster on large databases (no full rebuild) and leaves other tables untouched. The return value is still the DROP status code.

Verification

  • New testset drop! keeps other rowids and works in a transaction. On master it fails with (rowid = [1, 2], ...) == (rowid = [2, 3], ...) and SQLiteException("cannot VACUUM from within a transaction"); on this branch it passes 2/2.
  • Pkg.test() passes on Julia 1.12 (525/525) and 1.10.
  • Re-read for callers: nothing in the package calls drop!. The existing "cannot drop a table locked by a statement" tests still throw, because the DROP itself fails there, not the VACUUM.

🤖 Generated with Claude Code

quinnj and others added 2 commits November 16, 2026 12:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VACUUM rebuilds the whole database. It renumbered the rowids of every
table without an INTEGER PRIMARY KEY, and SQLite refuses it inside a
transaction, so drop! failed there and rolled back the drop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (adc6694) to head (9d9b8cd).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #378      +/-   ##
==========================================
- Coverage   96.81%   96.79%   -0.02%     
==========================================
  Files           5        5              
  Lines         785      781       -4     
==========================================
- Hits          760      756       -4     
  Misses         25       25              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quinnj-bot
quinnj-bot Bot merged commit 06aad10 into master Nov 16, 2026
12 of 16 checks passed
@quinnj-bot
quinnj-bot Bot deleted the claude/drop-without-vacuum branch November 16, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant